/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.library.model;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

/**
 * @author Velocity
 */
public class BookClp extends BaseModelImpl<Book> implements Book {
	public BookClp() {
	}

	public int getPrimaryKey() {
		return _BookId;
	}

	public void setPrimaryKey(int pk) {
		setBookId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Integer(_BookId);
	}

	public int getBookId() {
		return _BookId;
	}

	public void setBookId(int BookId) {
		_BookId = BookId;
	}

	public String getBookTitle() {
		return _BookTitle;
	}

	public void setBookTitle(String BookTitle) {
		_BookTitle = BookTitle;
	}

	public String getAuthor() {
		return _Author;
	}

	public void setAuthor(String Author) {
		_Author = Author;
	}

	public Book toEscapedModel() {
		if (isEscapedModel()) {
			return this;
		}
		else {
			return (Book)Proxy.newProxyInstance(Book.class.getClassLoader(),
				new Class[] { Book.class }, new AutoEscapeBeanHandler(this));
		}
	}

	public Object clone() {
		BookClp clone = new BookClp();

		clone.setBookId(getBookId());
		clone.setBookTitle(getBookTitle());
		clone.setAuthor(getAuthor());

		return clone;
	}

	public int compareTo(Book book) {
		int pk = book.getPrimaryKey();

		if (getPrimaryKey() < pk) {
			return -1;
		}
		else if (getPrimaryKey() > pk) {
			return 1;
		}
		else {
			return 0;
		}
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		BookClp book = null;

		try {
			book = (BookClp)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		int pk = book.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(7);

		sb.append("{BookId=");
		sb.append(getBookId());
		sb.append(", BookTitle=");
		sb.append(getBookTitle());
		sb.append(", Author=");
		sb.append(getAuthor());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(13);

		sb.append("<model><model-name>");
		sb.append("com.library.model.Book");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>BookId</column-name><column-value><![CDATA[");
		sb.append(getBookId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>BookTitle</column-name><column-value><![CDATA[");
		sb.append(getBookTitle());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>Author</column-name><column-value><![CDATA[");
		sb.append(getAuthor());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private int _BookId;
	private String _BookTitle;
	private String _Author;
}